﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Configuration;

/// <summary>
/// Summary description for MapConnection
/// </summary>
public class MapConnection
{
	public MapConnection()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public static SqlConnection GetConnection()
    {
        SqlConnection conn = null;
        try
        {
            conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MapConection"].ConnectionString);
            conn.Open();
        }
        catch (Exception)
        {
            
        }
        return conn;
    }

    public static bool CloseConnetion(SqlConnection conn)
    {
        try
        {
            if (conn.State == System.Data.ConnectionState.Open)
                conn.Close();
            return true;
        }
        catch (Exception)
        {
            return false;            
        }
    }
}